<?php
namespace app\zhihui\controller;

use app\common\model\ZhIntroduce as ZhIntroduceModel;
use app\home\controller\Base;

/**
 * 高僧大德控制器
 * Class Zhmonks
 * @package app\index\controller
 */
class Zhintroduce extends Base
{
    /**
     * [index  列表]
     * @return json
     * @author [C。]
     */
    public function index()
    {
        $param = input('param.');
        $model = new ZhIntroduceModel;
        $this->getPageAndSize($param);
        try {
            $intro = $model->getAllData(['comid'=>$param['comid'],'status'=>1],'id','id,title','asc');
            $arr[0]['id'] = $param['comid'];
            $arr[0]['title'] = '寺院简介';
            $arr[0]['type'] = '默认';
            $intro = array_merge($arr,$intro);
        } catch (\Exception $e) {
            systembug($e->getMessage(),2,$this->url);
            return admin_json(-1, $e->getMessage());
        }
        return admin_json(1, '获取成功', $intro);
    }
    /**
     * [get  获取一条]
     * @return json
     * @author [C。]
     */
    public function get()
    {
        $param = input('param.');
        $model = new ZhIntroduceModel;
        try{
            $data = $model->findData($param['id'],'id','content');
        } catch (\Exception $e) {
            systembug($e->getMessage(),2,$this->url);
            return admin_json(-1, $e->getMessage());
        }
        return admin_json(1, '获取成功',$data);
    }
}